//
//  HSettingCell.m
//  BXlive
//
//  Created by huangzhiwen on 2017/3/21.
//  Copyright © 2017年 cat. All rights reserved.
//

#import "HSettingCell.h"
#import <SLDeveloperTools/SLDeveloperTools.h>
#import <YYCategories/YYCategories.h>
#import <SDAutoLayout/SDAutoLayout.h>
#import <Masonry/Masonry.h>

@interface HSettingCell ()

@property (nonatomic,strong) UILabel *contentLabel;//内容
@property (nonatomic,strong) UIView *fengeView;//分割线

@end

@implementation HSettingCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        [self createUI];
    }
    return self;
}

- (void)createUI{
    WS(weakSelf);
    self.titleLabel = [UILabel initWithFrame:CGRectZero size:14 color:[UIColor blackColor] alignment:NSTextAlignmentLeft lines:1];
    self.titleLabel.font = SLBFont(__ScaleWidth(15));
    [self.contentView addSubview:self.titleLabel];
    
    self.nextImageView = [[UIImageView alloc]initWithFrame:CGRectZero];
    self.nextImageView.image = [UIImage imageNamed:@"箭头下一步"];
    [self.contentView addSubview:self.nextImageView];
    
    self.contentLabel = [UILabel initWithFrame:CGRectZero size:16 color:sl_textSubColors alignment:NSTextAlignmentRight lines:1];
    self.contentLabel.font = SLPFFont(__ScaleWidth(16));
    [self.contentView addSubview:self.contentLabel];
    
//    self.fengeView = [[UIView alloc]initWithFrame:CGRectZero];
//    self.fengeView.backgroundColor = LineNormalColor;
//    [self.contentView addSubview:self.fengeView];
    
    
    self.titleLabel.sd_layout.leftSpaceToView(self.contentView,15).topSpaceToView(self.contentView,0).bottomSpaceToView(self.contentView,0).widthIs(180);
    self.nextImageView.sd_layout.rightSpaceToView(self.contentView,15).topSpaceToView(self.contentView,21).bottomSpaceToView(self.contentView,21).widthIs(7);
    self.contentLabel.sd_layout.rightSpaceToView(self.contentView,15).topSpaceToView(self.contentView,0).bottomSpaceToView(self.contentView,0).widthIs(100);
    
    
    self.subTitleLabel = [UILabel createLabelWithFrame:CGRectZero BackgroundColor:SLClearColor Text:@"" Font:SLPFFont(__ScaleWidth(15)) TextColor:sl_textSubColors];
    [self.contentView addSubview:self.subTitleLabel];
    [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(__ScaleWidth(-28));
        make.left.equalTo(weakSelf.titleLabel.mas_right).offset(__ScaleWidth(10));
        make.centerY.mas_equalTo(0);
        make.height.mas_equalTo(__ScaleWidth(21));
    }];
    self.subTitleLabel.textAlignment = NSTextAlignmentRight;
}

- (void)setIsLast:(BOOL)isLast {
    _isLast = isLast;
    self.fengeView.hidden = isLast;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
